﻿<local:DocumentBase x:Class="WPFExcelReport.ABPR"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:ReflectionStudio.Components.UserControls;assembly=ReflectionStudio.Core"
                    xmlns:db="clr-namespace:ReflectionStudio.Core.Database;assembly=ReflectionStudio.Core"
                    xmlns:fd="clr-namespace:Labs.Filtering;assembly=ReflectionStudio.Core"
                    xmlns:wep="clr-namespace:WPFExcelReport"
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"
                    Loaded="Window_Loaded"
                    Title="订单单价"  
                    HorizontalAlignment="Stretch"  Margin="0,0,0,0"  VerticalAlignment="Stretch"
                    >
    <local:DocumentBase.Resources>
        <Style x:Key="GroupHeaderStyle" TargetType="{x:Type GroupItem}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type GroupItem}">
                        <Expander x:Name="exp" IsExpanded="True"
                          Background="White"
                          Foreground="Black">
                            <Expander.Header>
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock Text="{Binding Path=ARTICLE}" />
                                    <TextBlock Text="{Binding Path=ItemCount}"/>
                                    <TextBlock Text="Items"/>
                                </StackPanel>
                            </Expander.Header>
                            <ItemsPresenter />
                        </Expander>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <db:INTEXDataSet x:Key="iNTEXDataSet" />
        <CollectionViewSource  x:Key="FlickrGroupedFeed" Source="{Binding Path=WBBEW,Source={StaticResource iNTEXDataSet}}">
        </CollectionViewSource>
    </local:DocumentBase.Resources>
    <Grid DataContext=""  HorizontalAlignment="Stretch"  Margin="10,10,0,0"  VerticalAlignment="Stretch">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="600" />
            <ColumnDefinition Width="400" />
        </Grid.ColumnDefinitions>
        
        <StackPanel Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2">
            <WrapPanel >
                <Label Content="开单日期从" Height="26" HorizontalAlignment="Left" Margin="10,16,0,0" Name="label1" VerticalAlignment="Top" Width="94" FontSize="16" />
                <DatePicker Height="25" HorizontalAlignment="Left" Margin="10,16,0,0" Name="FROM_INSPECTION_DATE" VerticalAlignment="Top"  
                                SelectedDateChanged ="FROM_INSPECTION_DATE_SelectedDateChanged" Width="95" />
                <Label Content="至" Height="28" HorizontalAlignment="Left" Margin="10,16,0,0" Name="label2" VerticalAlignment="Top" Width="29" FontSize="16" />
                <DatePicker Height="25" HorizontalAlignment="Left" Margin="10,16,0,0" Name="END_INSPECTION_DATE" VerticalAlignment="Top" 
                                SelectedDateChanged ="END_INSPECTION_DATE_SelectedDateChanged" Width="95" />
                <Label Content="单号" Height="30" HorizontalAlignment="Left" Margin="5,16,0,0" Name="label4" VerticalAlignment="Top" FontSize="18" Width="45" />
                <TextBox Height="30" HorizontalAlignment="Right" Margin="5,10,0,0" Name="ORDERNO" VerticalAlignment="Top" Width="139" FontSize="18" 
                         BorderBrush="#FF2E2A2A" Background="#FFF2E6E6" CharacterCasing="Upper" KeyboardNavigation.TabIndex="2" />
                <Button  Content="查询"  Height="23" Margin="10,0,0,0"  Name="btnQuery" Width="75" Click="btnQuery_Click" KeyboardNavigation.TabIndex="6" />
                <Button Content="导出EXCEL" Margin="10,0,0,0"   Height="23"   Name="btnReport" Width="75" Click="btnReport_Click" KeyboardNavigation.TabIndex="7" />
            </WrapPanel>           
        </StackPanel>
        <WrapPanel Grid.Row="2"  Grid.Column="0"  Grid.ColumnSpan="2">
            <fd:FilteringDataGrid 
                AutoGenerateColumns="False" EnableRowVirtualization="True"  ItemsSource="{Binding}" HeadersVisibility="Column" x:Name="MasterDg" 
                                             CanUserReorderColumns="True"  CanUserResizeColumns="True" CanUserSortColumns="True" IsFilteringCaseSensitive="False" 
                                              RowDetailsVisibilityMode="VisibleWhenSelected"   
                                              Width="Auto"
                                              Height="500"
                                              EnableColumnVirtualization="True"  
                                              ScrollViewer.HorizontalScrollBarVisibility="Auto"
                                              ScrollViewer.VerticalScrollBarVisibility="Auto"
                                              SelectionChanged="ItemsControls_SelectionChanged"
                                              >
                <DataGrid.Columns>
              
                    <DataGridTextColumn Binding="{Binding Path=ORDERNO}" Header="订单号" Width="SizeToCells"  MinWidth="60"/>
                    <DataGridTextColumn Binding="{Binding Path=ABPNEUDAT}" Header="开单日期"  Width="SizeToCells"  MinWidth="40"/>
                    <DataGridTextColumn Binding="{Binding Path=ORDERTYPE}" Header="订单类型" Width="SizeToCells"  MinWidth="60"/>
                    <DataGridTextColumn Binding="{Binding Path=STATUS}" Header="订单状态" Width="SizeToCells"  MinWidth="40"/>
                    <DataGridTextColumn Binding="{Binding Path=ARTICLE}" Header="品种"  Width="SizeToCells"  MinWidth="80"/>
                    <DataGridTextColumn Binding="{Binding Path=FACTORY}" Header="外加工厂"  Width="SizeToCells"  MinWidth="70"/>
                    <DataGridTextColumn Binding="{Binding Path=PRICE}" Header="单价"  Width="SizeToCells"  MinWidth="40"/>
                    <DataGridTextColumn Binding="{Binding Path=ARMRKM1}" Header="费用1类型"  Width="SizeToCells"  MinWidth="50"/>
                    <DataGridTextColumn Binding="{Binding Path=WERT1}" Header="费用1"  Width="SizeToCells"  MinWidth="50"/>
                    <DataGridTextColumn Binding="{Binding Path=ARMRKM2}" Header="费用2类型"  Width="SizeToCells"  MinWidth="50"/>
                    <DataGridTextColumn Binding="{Binding Path=WERT2}" Header="费用2"  Width="SizeToCells"  MinWidth="50"/>
                </DataGrid.Columns>
            </fd:FilteringDataGrid>
        </WrapPanel>
    </Grid>
</local:DocumentBase>
